n = input("请输入数字,若想退出请输入q:")
sum = 0
cnt = 0
while n != "q":
    n = float(n)
    sum += n
    cnt += 1
    n = input("请输入数字,若想退出请输入q:")
if cnt == 0:
    average = 0
else:
    average = sum / cnt
print("平均值为" + str(average))
